//
//  BattleScene.m
//  ShoutBoss
//
//  Created by Luck Mstone on 6/15/09.
//  Copyright 2009 MS. All rights reserved.
//

#import "BattleScene.h"
#import "BattleScene/BackGroundLayer.h"
#import "BattleScene/BattleLayer.h"
#import "MenuItem.h"
#import "Menu.h"
#import "cocos2d.h"
#import "MainMenuScene.h"

@implementation BattleScene

-(id) init
{
	self = [super init];
	if(self != nil){
		//BattleScene 初始化工作
		//背景层
		CGSize s = [[Director sharedDirector] winSize];
		BackGroundLayer* backgroundlayer = [BackGroundLayer node];
		[self addChild:backgroundlayer];
		[backgroundlayer setPosition: ccp(s.width/2, s.height/2)];
		
		//菜单选项
		MenuItem *menuItem1 = [MenuItemFont itemFromString:@"M" target:self selector:@selector(onM:)];
		
		Menu *menu = [Menu menuWithItems:menuItem1,nil];
		[menu alignItemsVertically];
		menu.position = ccp(20, s.height - 20);
		
		[self addChild:menu];
		
		//战斗层
		BattleLayer *battlelayer = [BattleLayer node];
		[self addChild:battlelayer];
	}
	
	return self;
}

-(void)onM:(id)sender
{
	// 切换到MainMenu
	MainMenuScene* mainMenuScene = [MainMenuScene node];
	[[Director sharedDirector] replaceScene:mainMenuScene];
}

@end
